ImageGear Professional v18.2 > User Guide > Using ImageGear > Scanning Images > Scanning Images Using the ISIS Interface > Simplifying the Scanning Application |
Now that you have seen how to individually load, initialize, and link drivers, there is a simpler way that can often be used to make the toolkit do much of this work for you: IG_ISIS_drv_load_init_pipe(). Here are the steps involved in writing the same scanning application using IG_ISIS_drv_load_init_pipe():
Copy Code
|
|
---|---|
IG_ISIS_drv_load_init_pipe (0, "SPEW|PIXFPACK", &hScan, 0);
|
Copy Code
|
|
---|---|
IG_ISIS_tag_set_ascii(hScan, IG_ISIS_TAG_OUTPUTNAME, (char FAR *)"TEST.TIF"); IG_ISIS_tag_set_long(hScan, IG_ISIS_TAG_FILETYPE, 0, IG_ISIS_FILETYPE_TIFF); |
This step is the same as before, except the tags are set on the scanner driver because there is no handle to the file writing driver. (ISIS propagates all tags to every driver in the pipe, so this is not a problem). If you need access to a particular driver's handle, that driver must be loaded, initialized, and linked separately.
Copy Code
|
|
---|---|
IG_ISIS_run_zone (hScan, Buffer, BUFSIZE); |
This step is the same as before.
Copy Code
|
|
---|---|
IG_ISIS_drv_unload_pipe (hScan); |
This single function unloads the entire pipe. If you loaded and linked any drivers using separate functions, they also will be unlinked and unloaded by the call to IG_ISIS_drv_unload_pipe() .
Here is the complete simplified code to scan a page to a file:
Copy Code
|
|
---|---|
#define BUFSIZE 8192 { char Buffer[BUFSIZE]; HISISDRV hScan; /* Load and initialize the pipe */ IG_ISIS_drv_load_init_pipe(0, "SPEW|PIXFPACK", &hScan, 0); /* Set tags to correctly write the file */ IG_ISIS_tag_set_ascii(hScan, IG_ISIS_TAG_OUTPUTNAME, (char FAR *)"TEST.TIF"); IG_ISIS_tag_set_long(hScan, IG_ISIS_TAG_FILETYPE, 0, IG_ISIS_FILETYPE_TIFF); /* Invoke the pipe and scan the page */ IG_ISIS_run_zone(hScan, Buffer, BUFSIZE); /* Unlink and unload the drivers */ IG_ISIS_drv_unload_pipe(hScan); } |